/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * enrollInterface.java
 *
 * Created on 2011年4月14日, 上午03:32:42
 */

package csci3170;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;

/**
 *
 * @author KOLee
 */
public class enrollInterface extends javax.swing.JFrame {

    /** Creates new form enrollInterface */
    public enrollInterface() {
        initComponents();

      //Search Courses ( SC)
        SC_bSearch.addActionListener(new ActionListener(){

             public void actionPerformed(ActionEvent e) {
               courseEnrollmentSystem s = courseEnrollmentSystem.getApplication();




               String Term, Year, Department;
               Term = SC_tTerm.getText();
               Year = SC_tYear.getText();
               Department = SC_tDepartment.getText();
                String queryx= "SELECT	P.CourseID, P.PreCourseID "
                             + " FROM	Prerequisite P ";

               String[] query = {"Mess","SELECT c.CourseID, c.CourseName, tc.year,tc.term,c.Credit,c.Department,tc.professor,tc.quota,tc.numberofenrolledstudent " //pc.precourseid "
                                +"FROM (SELECT * FROM termcourse WHERE numberofenrolledstudent < quota)  tc ,course c "  // prerequisite pc "
                                +"WHERE c.CourseID = tc.CourseID "
                               // + "AND c.CourseID = pc.CourseID "
                                +"AND tc.year = "+Year+" AND tc.term = "+Term+" AND c.department = '"+Department+"' "
                                +"ORDER BY c.courseID ASC",
                                queryx
                                };

               s.setInput(query);


                  Result result =  s.getOutput();

                if(result.Check.equals( "false" ) ){
                    JOptionPane.showMessageDialog(null, "Fail!");
               }else{
                      String tables ="";
                      for(String table:result.Set){
                        tables += table+"\n\n";
                        System.out.println( " result: \n" +table);
                    }

                      SC_DisplayArea.setText(tables+"\n");

               }
        //       System.out.println(result);

            }

        });


      //Enroll/Drop (ED)
        ED_bDrop.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
               courseEnrollmentSystem s = courseEnrollmentSystem.getApplication();

               String Term, Year, CourseID,StudentID;
               Term = ED_tTerm.getText();
               Year = ED_tYear.getText();
               CourseID = ED_tCourseID.getText();
               StudentID = ED_tStudentID.getText() ;

                String[] query = {"drop"," DELETE FROM	Enrollment E  WHERE E.StudentID = '"+StudentID+"' AND E.CourseID = '"+CourseID+"' AND E.Year = "+Year+" AND E.Term = "+Term+""
                       ," UPDATE TermCourse TC SET TC.NumberOfEnrolledStudent = TC.NumberOfEnrolledStudent - 1  WHERE	TC.CourseID = '"+CourseID+"' AND TC.Year = "+Year+" AND TC.Term = "+Term+" " };


               s.setInput(query);


                  Result result =  s.getOutput();

                if(result.Check.equals( "true" ) ){
                     JOptionPane.showMessageDialog(null, "Successful!");
               }else{
                      JOptionPane.showMessageDialog(null,result.Check);
                      ED_DisplayArea.setText(result.Check);
               }


            }
        });

        ED_bEnroll.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
               courseEnrollmentSystem s = courseEnrollmentSystem.getApplication();

               String Term, Year, CourseID,StudentID;
               Term = ED_tTerm.getText();
               Year = ED_tYear.getText();
               CourseID = ED_tCourseID.getText();
               StudentID = ED_tStudentID.getText() ;

               String query7 = "SELECT	* "
                       + " FROM	TermCourse TC"
                       + " WHERE TC.CourseID = '"+CourseID+"' "
                       + " AND TC.Year = "+Year+" AND TC.Term = "+Term+"";

               String query1 = "SELECT	TC.CourseID, (TC.Quota - TC.NumberOfEnrolledStudent) AS RemainQuota "
                       + "FROM TermCourse TC "
                       + "WHERE TC.CourseID = '"+CourseID+"' "
                       + "AND TC.Year = "+Year+" "
                       + "AND TC.Term = "+Term+" "
                       + "AND (TC.Quota - TC.NumberOfEnrolledStudent) != 0";

               String query2 = "SELECT	* FROM	TermCourse TC  "
                       + "WHERE	'"+CourseID+" '"
                       + "NOT IN ( 	"
                       + "SELECT	E.CourseID 	"
                       + "FROM	Enrollment E	"
                       + "WHERE	E.StudentID = '"+StudentID+"')";

               String query3 = "SELECT	* FROM	Student S "
                       + "WHERE	S.StudentID = '"+StudentID+"'	"
                       + "AND NOT EXISTS (	"
                       + "(	SELECT	P.PreCourseID	"
                       + "FROM	Prerequisite P	"
                       + "WHERE	P.CourseID = '"+CourseID+"' )"
                       + " MINUS "
                       + "(	SELECT	E.CourseID FROM	Enrollment E "
                       + "WHERE	E.StudentID = '"+StudentID+"' )	)";

               String query4 = "SELECT	S.StudentID"
                       + " FROM	Student S"
                       + " WHERE	S.StudentID = '"+StudentID+"' AND ("
                       + "	SELECT	SUM(C.Credit) AS TermTotalCredit"
                       + "	FROM	Enrollment E, Course C"
                       + "	WHERE	E.CourseID = C.CourseID AND E.StudentID = '"+StudentID+"' AND E.Year = "+Year+" AND E.Term = "+Term+""
                       + ") + ("
                       + "	SELECT	C.Credit"
                       + "	FROM	Course C"
                       + "	WHERE	C.CourseID = '"+CourseID+"') <= 21";

               String query5 = "INSERT	INTO Enrollment (CourseID, Year, Term, StudentID) "
                       + " VALUES	('"+CourseID+"', "+Year+", "+Term+", '"+StudentID+"')";

               String query6 = "UPDATE 	TermCourse TC SET TC.NumberOfEnrolledStudent = TC.NumberOfEnrolledStudent + 1 "
                       + " WHERE	TC.CourseID = '"+CourseID+"' AND TC.Year = "+Year+" AND TC.Term = "+Term+"";


                String[] query = {"enroll",query1,query2,query3,query4,query5,query6,query7};


               s.setInput(query);


                  Result result =  s.getOutput();

                if(result.Check.equals( "true" ) ){
                     JOptionPane.showMessageDialog(null, "Successful!");
               }else{
                      JOptionPane.showMessageDialog(null,result.Check);
                      ED_DisplayArea.setText(result.Check);
               }


            }
        });

      //Show Enrolled Courses (SEC)

            b_show.addActionListener(new ActionListener(){

             public void actionPerformed(ActionEvent e) {
               courseEnrollmentSystem s = courseEnrollmentSystem.getApplication();

               String Term, Year, StudentID;
               Term = SEC_tTerm.getText();
               Year = SEC_tYear.getText();
               StudentID = SEC_tStudentID.getText();

                String queryx= "SELECT	P.CourseID, P.PreCourseID "
                             + " FROM	Prerequisite P ";
               String[] query = {  "EnrolledCourses" ,
                                   "SELECT	C.CourseID, C.CourseName, C.Credit, C.Department, TC.Year, TC.Term, TC.Professor, TC.Quota, TC.NumberOfEnrolledStudent "
                                   + " FROM	Student S, Course C, TermCourse TC, Enrollment E "
                                   + " WHERE	S.StudentID = '"+StudentID+"' AND TC.Year = "+Year+" AND TC.Term = "+Term+" "
                                   + " AND  TC.CourseID = C.CourseID AND E.CourseID = C.CourseID "
                                   + " AND TC.Year = E.Year AND TC.Term = E.Term AND E.StudentID = S.StudentID "
                                 //  + " AND C.CourseID NOT IN ( SELECT P.CourseID FROM  Prerequisite P) "
                                   + " ORDER BY C.Credit ",
                                   queryx

                                };


               s.setInput(query);


                  Result result =  s.getOutput();

                if(result.Check.equals( "false" ) ){
                    JOptionPane.showMessageDialog(null, "Fail!");
               }else{
                      String tables ="";
                      for(String table:result.Set){
                        tables += table+"\n\n";
                        System.out.println( " result: \n" +table);
                    }

                      SEC_DisplayArea.setText(tables+"\n");

               }

            }

        });
 



    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        enrollInterface = new javax.swing.JTabbedPane();
        SC = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        SC_bSearch = new javax.swing.JButton();
        SC_tYear = new javax.swing.JTextField();
        SC_tTerm = new javax.swing.JTextField();
        SC_tDepartment = new javax.swing.JTextField();
        SC_jScrollPane = new javax.swing.JScrollPane();
        SC_DisplayArea = new javax.swing.JTextArea();
        SEC = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        SEC_tStudentID = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        SEC_tYear = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        SEC_tTerm = new javax.swing.JTextField();
        b_show = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        SEC_DisplayArea = new javax.swing.JTextArea();
        ED = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        ED_tYear = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        ED_tCourseID = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        ED_tTerm = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        ED_tStudentID = new javax.swing.JTextField();
        ED_bDrop = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        ED_DisplayArea = new javax.swing.JTextArea();
        ED_bEnroll = new javax.swing.JButton();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N

        enrollInterface.setName("enrollInterface"); // NOI18N

        SC.setName("SC"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(csci3170.courseEnrollmentSystem.class).getContext().getResourceMap(enrollInterface.class);
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        SC_bSearch.setText(resourceMap.getString("SC_bSearch.text")); // NOI18N
        SC_bSearch.setName("SC_bSearch"); // NOI18N

        SC_tYear.setColumns(4);
        SC_tYear.setText(resourceMap.getString("SC_tYear.text")); // NOI18N
        SC_tYear.setMinimumSize(new java.awt.Dimension(6, 80));
        SC_tYear.setName("SC_tYear"); // NOI18N

        SC_tTerm.setColumns(3);
        SC_tTerm.setText(resourceMap.getString("SC_tTerm.text")); // NOI18N
        SC_tTerm.setName("SC_tTerm"); // NOI18N

        SC_tDepartment.setColumns(6);
        SC_tDepartment.setText(resourceMap.getString("SC_tDepartment.text")); // NOI18N
        SC_tDepartment.setName("SC_tDepartment"); // NOI18N

        SC_jScrollPane.setName("SC_jScrollPane"); // NOI18N

        SC_DisplayArea.setColumns(20);
        SC_DisplayArea.setEditable(false);
        SC_DisplayArea.setRows(5);
        SC_DisplayArea.setName("SC_DisplayArea"); // NOI18N
        SC_jScrollPane.setViewportView(SC_DisplayArea);

        javax.swing.GroupLayout SCLayout = new javax.swing.GroupLayout(SC);
        SC.setLayout(SCLayout);
        SCLayout.setHorizontalGroup(
            SCLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SCLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(SCLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(SC_jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 355, Short.MAX_VALUE)
                    .addGroup(SCLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(SC_tYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(SC_tTerm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(SC_tDepartment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(SC_bSearch))
                .addContainerGap())
        );
        SCLayout.setVerticalGroup(
            SCLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SCLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(SCLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(SC_tYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(SC_tTerm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(SC_tDepartment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(SC_bSearch)
                .addGap(4, 4, 4)
                .addComponent(SC_jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
                .addContainerGap())
        );

        enrollInterface.addTab(resourceMap.getString("SC.TabConstraints.tabTitle"), SC); // NOI18N

        SEC.setName("SEC"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        SEC_tStudentID.setColumns(8);
        SEC_tStudentID.setText(resourceMap.getString("SEC_tStudentID.text")); // NOI18N
        SEC_tStudentID.setName("SEC_tStudentID"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        SEC_tYear.setColumns(4);
        SEC_tYear.setText(resourceMap.getString("SEC_tYear.text")); // NOI18N
        SEC_tYear.setName("SEC_tYear"); // NOI18N

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        SEC_tTerm.setColumns(2);
        SEC_tTerm.setText(resourceMap.getString("SEC_tTerm.text")); // NOI18N
        SEC_tTerm.setName("SEC_tTerm"); // NOI18N

        b_show.setText(resourceMap.getString("b_show.text")); // NOI18N
        b_show.setName("b_show"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        SEC_DisplayArea.setColumns(20);
        SEC_DisplayArea.setEditable(false);
        SEC_DisplayArea.setRows(5);
        SEC_DisplayArea.setName("SEC_DisplayArea"); // NOI18N
        jScrollPane2.setViewportView(SEC_DisplayArea);

        javax.swing.GroupLayout SECLayout = new javax.swing.GroupLayout(SEC);
        SEC.setLayout(SECLayout);
        SECLayout.setHorizontalGroup(
            SECLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SECLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(SECLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 355, Short.MAX_VALUE)
                    .addGroup(SECLayout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(SEC_tStudentID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(SEC_tYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(SEC_tTerm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(b_show))
                .addContainerGap())
        );
        SECLayout.setVerticalGroup(
            SECLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SECLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(SECLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(SEC_tStudentID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(SEC_tYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(SEC_tTerm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addComponent(b_show)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)
                .addContainerGap())
        );

        enrollInterface.addTab(resourceMap.getString("SEC.TabConstraints.tabTitle"), SEC); // NOI18N

        ED.setName("ED"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        ED_tYear.setColumns(5);
        ED_tYear.setText(resourceMap.getString("ED_tYear.text")); // NOI18N
        ED_tYear.setName("ED_tYear"); // NOI18N

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        ED_tCourseID.setColumns(8);
        ED_tCourseID.setText(resourceMap.getString("ED_tCourseID.text")); // NOI18N
        ED_tCourseID.setName("ED_tCourseID"); // NOI18N

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        ED_tTerm.setColumns(5);
        ED_tTerm.setText(resourceMap.getString("ED_tTerm.text")); // NOI18N
        ED_tTerm.setName("ED_tTerm"); // NOI18N

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        ED_tStudentID.setColumns(8);
        ED_tStudentID.setText(resourceMap.getString("ED_tStudentID.text")); // NOI18N
        ED_tStudentID.setName("ED_tStudentID"); // NOI18N

        ED_bDrop.setText(resourceMap.getString("ED_bDrop.text")); // NOI18N
        ED_bDrop.setName("ED_bDrop"); // NOI18N

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        ED_DisplayArea.setColumns(20);
        ED_DisplayArea.setEditable(false);
        ED_DisplayArea.setRows(5);
        ED_DisplayArea.setName("ED_DisplayArea"); // NOI18N
        jScrollPane3.setViewportView(ED_DisplayArea);

        ED_bEnroll.setText(resourceMap.getString("ED_bEnroll.text")); // NOI18N
        ED_bEnroll.setName("ED_bEnroll"); // NOI18N

        javax.swing.GroupLayout EDLayout = new javax.swing.GroupLayout(ED);
        ED.setLayout(EDLayout);
        EDLayout.setHorizontalGroup(
            EDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(EDLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(EDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 355, Short.MAX_VALUE)
                    .addGroup(EDLayout.createSequentialGroup()
                        .addGroup(EDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(EDLayout.createSequentialGroup()
                                .addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(ED_tTerm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(ED_tStudentID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(EDLayout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(ED_tYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel8)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(ED_tCourseID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 86, Short.MAX_VALUE)
                        .addGroup(EDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(ED_bDrop, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(ED_bEnroll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
        );
        EDLayout.setVerticalGroup(
            EDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(EDLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(EDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(ED_tYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ED_bEnroll)
                    .addComponent(jLabel8)
                    .addComponent(ED_tCourseID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(EDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(ED_tTerm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(ED_tStudentID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ED_bDrop))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)
                .addContainerGap())
        );

        enrollInterface.addTab(resourceMap.getString("ED.TabConstraints.tabTitle"), ED); // NOI18N

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(csci3170.courseEnrollmentSystem.class).getContext().getActionMap(enrollInterface.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(enrollInterface, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(enrollInterface, javax.swing.GroupLayout.DEFAULT_SIZE, 290, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
 /*   public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new enrollInterface().setVisible(true);
            }
        });
    }
  * */
  

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel ED;
    private javax.swing.JTextArea ED_DisplayArea;
    private javax.swing.JButton ED_bDrop;
    private javax.swing.JButton ED_bEnroll;
    private javax.swing.JTextField ED_tCourseID;
    private javax.swing.JTextField ED_tStudentID;
    private javax.swing.JTextField ED_tTerm;
    private javax.swing.JTextField ED_tYear;
    private javax.swing.JPanel SC;
    private javax.swing.JTextArea SC_DisplayArea;
    private javax.swing.JButton SC_bSearch;
    private javax.swing.JScrollPane SC_jScrollPane;
    private javax.swing.JTextField SC_tDepartment;
    private javax.swing.JTextField SC_tTerm;
    private javax.swing.JTextField SC_tYear;
    private javax.swing.JPanel SEC;
    private javax.swing.JTextArea SEC_DisplayArea;
    private javax.swing.JTextField SEC_tStudentID;
    private javax.swing.JTextField SEC_tTerm;
    private javax.swing.JTextField SEC_tYear;
    private javax.swing.JButton b_show;
    private javax.swing.JTabbedPane enrollInterface;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JMenuBar menuBar;
    // End of variables declaration//GEN-END:variables

}
